<template>
  <view class="ai-float-btn" @click="toAiChatPage">
    <image 
      src="/static/index/store.png" 
      mode="widthFix" 
      class="ai-icon"
    ></image>
  </view>
</template>

<script>
export default {
  methods: {
    toAiChatPage() {
      // 记录来源页面，便于返回
      const pages = getCurrentPages()
      const currentPage = pages[pages.length - 1].route
      uni.setStorageSync('aiChatBackUrl', currentPage)
      console.log(pages)
	  console.log(currentPage)
      // 跳转对话页
      uni.navigateTo({
        url: '/other_pages/aiChat/aiChat'
      })
    }
  }
}
</script>

<style scoped>
.ai-float-btn {
  position: fixed;
  right: 30rpx;
  bottom: 150rpx; /* 避开底部导航 */
  z-index: 999;
  width: 120rpx;
  height: 120rpx;
  border-radius: 50%;
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.2);
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-icon {
  width: 80rpx;
  height: 80rpx;
}
</style>